﻿package toolbar.font {
	import flash.text.*;
	import toolbar.NormalButton;
	import toolbar.icon.FontFamilyIcon;
	
	public class FontFamilyButton extends NormalButton {
		private var tf:TextField;
		private var format:TextFormat;
		
		public function FontFamilyButton(name:String):void {
			super(name, 98);
			addIcon(new FontFamilyIcon());
			tf = new TextField();
			tf.x = 6;
			tf.y = 4;
			tf.height = 16;
			tf.width = 72;
			tf.text = "宋体";
			tf.selectable = false;
			format = tf.getTextFormat(0, 1);
			format.font = "宋体";
			format.size = 12;
			format.align = TextFormatAlign.CENTER;
			tf.setTextFormat(format, 0, tf.text.length);
			addChild(tf);
		}
		
		public function setDisplayFamily(font:String):void {
			tf.text = font;
			tf.setTextFormat(format, 0, tf.text.length);
		}
	}
}